package com.nobradovic83.pygsto.domainmodel.beans;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.nobradovic83.pygsto.core.beans.BaseBean;
import com.nobradovic83.pygsto.domainmodel.Order;
import com.nobradovic83.pygsto.domainmodel.OrderDetail;
import com.nobradovic83.pygsto.domainmodel.User;

@Entity
public class OrderBean extends BaseBean implements Order{
	private Date orderDate;
	private User user;
	private List<OrderDetail> orderDetails;
	private boolean status;

	
	public Date getOrderDate() {
		return orderDate;
	}
	public void setOrderDate(Date orderDate) {
		this.orderDate = orderDate;
	}
	@ManyToOne(cascade={CascadeType.ALL},targetEntity=UserBean.class)
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public void setOrderDetails(List<OrderDetail> orderDetails) {
		this.orderDetails = orderDetails;
	}
	@OneToMany(mappedBy="order", cascade = {CascadeType.ALL}, targetEntity=OrderDetailBean.class)
	public List<OrderDetail> getOrderDetails() {
		return orderDetails;
	}
	public void setStatus(boolean status) {
		this.status = status;
	}
	public boolean isStatus() {
		return status;
	}
}
